<?
	class Product_review extends DB
	{
		function __construct($other_conn=null)
		{
			parent::__construct(Tproduct_review,$other_conn);
			$this->table=Tproduct_review;
		}

		function get_summary($pid)
		{	
			//review_status 2 = approved
			$result = $this->query("SELECT avg(rating) avg_score, count(*) cnt FROM $this->table WHERE review_status=2 and product_id = " . $pid );
			$row = $this->fetch_array($result);
			return $row;
		}

	}
?>
